package com.ce.webframework.sec.dao.impl;


import java.util.ArrayList;
import java.util.List;

import com.ce.webframework.sec.dao.ISecToolbarTempDao;
import com.ce.webframework.sec.model.SecToolbarTempDO;
import com.sitechasia.webx.core.dao.hibernate3.HibernateDomainObjectDao;

public class SecToolbarTempDaoImpl extends HibernateDomainObjectDao<SecToolbarTempDO> implements ISecToolbarTempDao{


	/**
	 *
	 * 功能描述:查询当前用户所有未应用的快捷菜单(根据应orderNum字段排序)
	 * @param userId 当前用户ID
	 * @param functionIds 权限功能ID的集合
	 *@return List
	 */
	public List<SecToolbarTempDO> getUnuseCutMenus(Long userId,List functionIds) {
		if(functionIds==null) return new ArrayList<SecToolbarTempDO>();
		String funcIdsSplit = "";

		for(int i=0;i<functionIds.size();i++){
			System.out.println("functionIds=========="+i+" : "+functionIds.get(i).toString());
			String funcId = "'"+functionIds.get(i).toString()+"'";
			funcIdsSplit+=funcId;
			if(i!=functionIds.size()-1)
				funcIdsSplit+=",";
		}


		System.out.println("funcIdsSplit=================="+funcIdsSplit);

		String hsql ="FROM SecToolbarTempDO temp where temp.functionEntityId in ("+funcIdsSplit+") " +
				"AND temp.toolbarTempId not in (" +
				"SELECT cut.secToolbarTemp.toolbarTempId FROM SecToolbarDO cut WHERE cut.userId='"+userId+"')";
		List<SecToolbarTempDO> tempList = getHibernateTemplate().find(hsql);
		return tempList;
	}



}
